FirstConsecutiveEqual Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Finds the first occurence of count consecutive "equal" items in the list. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static int FirstConsecutiveEqual<T>(
	IList<T> list,
	int count,
	BinaryPredicate<T> predicate
)
Visual Basic (Declaration)
Public Shared Function FirstConsecutiveEqual(Of T) ( _
	list As IList(Of T), _
	count As Integer, _
	predicate As BinaryPredicate(Of T) _
) As Integer
Visual C++
public:
generic<typename T>
static int FirstConsecutiveEqual (
	IList<T>^ list, 
	int count, 
	BinaryPredicate<T>^ predicate
)

Parameters

list
IList<(Of <T>)>
The list to examine.
count
Int32
The number of consecutive equal items to look for. The count must be at least 1.
predicate
BinaryPredicate<(Of <T>)>
The BinaryPredicate used to compare items for "equality".

Return Value

The index of the first item in the first run of count consecutive equal items, or -1 if no such run exists.

Type Parameters

T

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being tested for need not be true equality.

See Also